package cn.accjiyun.gomoku.model;

import java.util.Stack;

/**
 * Created by jiyun on 2016/9/7.
 * The Chessboard data structure.
 */
public class Chessboard {

    private int boardSize;
    private final int MAXSIZE = 22;
    private ChessPoint[][] chessArray;
    private Stack<ChessPoint> ChessStack;
    private Stack<ChessPoint> undoStack;
    private int mode;
    private boolean isWin;

    public void setWin(boolean win) {
        isWin = win;
    }

    public boolean isWin() {
        return isWin;
    }

    public Chessboard() {
        mode = Mode.EMPTY;
        clear();
    }

    public Stack<ChessPoint> getChessStack() {
        return ChessStack;
    }

    public Stack<ChessPoint> getUndoStack() {
        return undoStack;
    }

    public int getBoardSize() {
        return boardSize;
    }

    public void setBoardSize(int boardSize) {
        this.boardSize = boardSize;
    }

    public ChessPoint[][] getChessArray() {
        return chessArray;
    }

    public int getMode() {
        return mode;
    }

    public void setMode(int mode) {
        this.mode = mode;
    }

    public void clear() {
        chessArray = new ChessPoint[MAXSIZE][MAXSIZE];
        for (int i = 0; i < MAXSIZE; i++) {
            for (int j = 0; j < MAXSIZE; j++) {
                chessArray[i][j] = new ChessPoint();
            }
        }
        ChessStack = new Stack<>();
        undoStack = new Stack<>();
        isWin = false;
    }
}
